using System;
using HCP.Responses;
using HCP.SimpleJSON;
using UnityEngine;

namespace HCP.Requests
{
	public class GetElementLocation : JobRequest
	{
		public GetElementLocation(JSONClass json) : base(json)
		{
		}

		public string Id
		{
			get
			{
				return base.Data["elementId"];
			}
		}

		public override JobResponse Process()
		{
			Component elementById = JobRequest.GetElementById(this.Id);
			Rect rect = Element.ConstructScreenRect(elementById);
			Vector3 vector = new Vector3
			{
				x = rect.x,
				y = rect.y,
				z = 0f
			};
			return JSONResponse.FromObject(new
			{
				x = (int)vector.x,
				y = (int)vector.y,
				z = (int)vector.z
			});
		}
	}
}
